from bs4 import BeautifulSoup
with open('dou1.txt' , mode='r',encoding='utf-8') as f:
    text = f.read()
soup = BeautifulSoup(text,'lxml')
# 标签选择器
# # print(soup.prettify())
# print(soup.title)
# # print(soup.head)
# print(soup.p)
# print(soup.p['class']) # 获取p标签里的class里的值
# print(soup.p.string) # 获取p标签里的内容
# print(soup.head.meta) # 嵌套选择标签里面的标签
# # 获取所有的子节点
# # print(soup.head.contents)
# # for i, child in enumerate(soup.head.descendants):
# #     print(i, child)
# # 获取所有的父节点s
# # print(soup.p.parent)
# # 获取所有的祖先节点
# # print(soup.p.parent)
# # 获取所有的兄弟节点
# print(enumerate(soup.a.next_siblings))
# print(enumerate(soup.a.previous_siblings))
# 标准选择器
# print(soup.find_all('ul'))
# 嵌套查找
# for i in soup.find_all('ul'):
#     print(i.find_all('li'))
# print(soup.find_all(class_='author'))
# print(soup.find_all(id='author'))
# 获取属性,获取文本
for ul in soup.select('li'):
    print(ul.get_text().split())